package com.jfinal.ssl.task;

import com.jfinal.aop.Aop;
import com.jfinal.plugin.cron4j.ITask;
import com.jfinal.ssl.controller.SslServer;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.cert.CertificateException;

public class CheckSSLTask implements ITask {

    @Override
    public void run() {
        System.out.println("定时检测证书是否过期");
        //定时检测证书是否过期
        SslServer sslServer = Aop.get(SslServer.class);
        try {
            sslServer.doMain();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (CertificateException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public void stop() {

    }
}
